package com.example.dto;


import com.example.domain.Category;
import com.example.domain.Dish;
import com.example.domain.Setmeal;
import com.example.domain.other.BaseEntity;
import com.example.domain.other.SetmealDish;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Data
public class SetmealDishDto extends BaseEntity {
    private Long sid;
    private Long categoryId;  //分类id
    private String categoryName;  //分类名称
    private String name;   //套餐名称
    private BigDecimal price;  //套餐价格
    private Integer status;  //状态 0:停用 1:启用
    private String code;   //编码
    private String description;   //描述信息
    private String image;  //图片

    private List<SetmealDish> setMealDishList=new ArrayList<>();  //套餐中的菜品列表

    public Setmeal gainSetmeal(){
         Setmeal setmeal=new Setmeal();
         setmeal.setCategoryId(this.categoryId);
         setmeal.setName(this.name);
         setmeal.setPrice(this.price);
         setmeal.setStatus(this.status);
         setmeal.setCode(this.code);
         setmeal.setDescription(this.description);
         setmeal.setImage(this.image);
         return setmeal;
    }
    public void gainSetmealDishDto(Setmeal setmeal,List<SetmealDish> list){
        this.sid=setmeal.getId();
        this.categoryId= setmeal.getCategoryId();
        this.name= setmeal.getName();
        this.price= setmeal.getPrice();
        this.status= setmeal.getStatus();
        this.code= setmeal.getCode();
        this.description= setmeal.getDescription();
        this.image= setmeal.getImage();
        this.setMealDishList=list;
    }
}
